package cn.ljy.authority.dao.mapper;

import cn.ljy.authority.dao.BaseMapper;
import cn.ljy.authority.model.SysDepartment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.List;

@Mapper
public interface SysDepartmentMapper extends BaseMapper<SysDepartment> {

    /**
     * 获取数据库所有部门，以树形方式存储
     * @return
     */
    List<SysDepartment> findTree();

    /**
     * 获取该部门下的所有子部门信息
     * @param id 部门主键
     */
    List<SysDepartment> findChildrenById(Serializable id);

    /**
     * 显示所有部门的名称
     * @return
     */
    @Select("select name from sys_department order by sort asc")
    List<String> getAllNames();
}
